package com.ec.cr.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ec.cr.domain.dto.ManufacturerRatioDTO;
import com.ec.cr.domain.dto.PriceTrendDTO;
import com.ec.cr.domain.entity.MedicineInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;


@Mapper
public interface MedicineInfoMapper extends BaseMapper<MedicineInfo> {

    // 模糊搜索（用于 el-select 下拉）
    List<MedicineInfo> searchByName(@Param("keyword") String keyword);

    List<MedicineInfo> selectPageList(String name, int pageSize, int offset);
    long countRecords(String name);
    int insert(MedicineInfo drug);
    void update(MedicineInfo drug);
    void delete(Long id);

    // Mapper 接口
    double avgPrice();
    double maxPrice();
    double minPrice();
    List<PriceTrendDTO> selectPriceTrend();
    List<ManufacturerRatioDTO> selectManufacturerRatio();

}
